<template>
  <el-date-picker
      v-model="propertyForm.valueText"
      type="daterange"
      range-separator="至"
      start-placeholder="开始日期"
      end-placeholder="结束日期"
      format="yyyy-MM-dd"
      value-format="yyyy-MM-dd"
      size="small"
      :picker-options="pickerOptions1"
      class="mr-10">
  </el-date-picker>
</template>

<script>

export default {
  name: 'DataPickerModle',
  props: ['property'],
  watch: {
    property: {
      immediate: true,
      handler(val) {
        // console.log('val,',val)
        this.propertyForm = this.getJson(val)
      }
    },
    'propertyForm.valueText': {
      handler() {
        // console.log('更新啦input：', val)
        this.$emit('updateVal', {'input': this.propertyForm})
      },
      deep: true
    },
  },
  data() {
    return {
      propertyForm: {},
      pickerOptions1: {
        disabledDate(time) {
          return time.getTime() > Date.now()//  - 8.64e7
        }
      }
    }
  },
  created() {
  },
  methods: {
    getJson(item){
      return JSON.parse(JSON.stringify(item))
    }
  },
  mounted() {
    // this.$emit('update:property', this.propertyForm)
  }
}
</script>
